#include <iostream>
#include <pthread.h>
#include <unistd.h>


using namespace std;
void *threadRun(void *args)
{
    while(1)
    {
        cout << "new thread: " << getpid() << endl;
        sleep(1);
    }
    return nullptr;
}
int main()
{
    pthread_t tid;
    pthread_create(&tid,nullptr,threadRun,nullptr);

    //主线程
    while(1)
    {
        std::cout << "main thread: " << getpid() << std::endl;
        sleep(1);
    }
}